# coding=utf-8

from win32com.client import Dispatch
import os

def thunderDownload(url, filename):
    # url = "ftp://ygdy8:ygdy8@yg39.dydytt.net:4017/阳光电影www.ygdy8.com.刺猬索尼克.BD.1080p.中英双字幕.mkv"
    # filename = 'aaa.mkv'
    thunder = Dispatch('ThunderAgent.Agent64.1')
    # AddTask("下载地址", "另存为文件名", "保存目录", "任务注释", "引用地址", "开始模式", "只从原始地址下载", "从原始地址下载线程数")
    thunder.AddTask(url, filename)
    thunder.CommitTasks()


def openUrlDownload(url):
    '''
    "C:\Program Files (x86)\Thunder Network\Thunder\Program\ThunderStart.exe" -StartType:DesktopIcon
    os.system(r'"C:\Program Files (x86)\Thunder Network\Thunder\Program\Thunder.exe" {url}'.format(url=url))
    '''
    url = "ftp://ygdy8:ygdy8@yg39.dydytt.net:4017/阳光电影www.ygdy8.com.刺猬索尼克.BD.1080p.中英双字幕.mkv"
    url_li = []
    with open(r"E:\git_pro\wangdu_spider\xunlei_downloads\all_url.txt", encoding='utf-8') as fp:
        url = fp.read()

    print(url)
    os.system(r'"C:\Program Files (x86)\Thunder Network\Thunder\Program\ThunderStart.exe" {url}'.format(url=url))



if __name__ == '__main__':
    thunderDownload("ftp://ygdy8:ygdy8@yg18.dydytt.net:8012/阳光电影www.ygdy8.com.朱迪与潘趣.BD.1080p.中英双字幕.mkv", './aaa/test.mkv')